package com.cropdoctor.util;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;

import java.util.HashMap;

public class ContextGet {
    public static long getUserId(){
         return Long.valueOf(((HashMap<String, Object>) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).get("userid").toString());
    }
}
